package demo04

/**
 * @author xiaoZhao
 * @date 2022/6/28
 * @describe 函数至简原则
 */
object Test03_FunctionSimplify {
  def main(args: Array[String]): Unit = {

    def f0(name: String): String = {
      return name
    }
    println(f0("hello world "))



    def f1(name: String): String = {
      name
    }
    println(f1("hello world "))


    def f2(name: String): String = name

    println(f2("hello world "))

    def f3(name: String) = name

    println(f3("hello world "))


    // 匿名函数 lambda表达式
    (name: String)=>{ println(name) }
  }
}
